package fussbudget.abstracts;

import javax.swing.JTable;
import javax.swing.table.JTableHeader;
import javax.swing.table.TableCellRenderer;
import javax.swing.table.TableColumnModel;

import fussbudget.gui.components.BasicPopupMenu;
import fussbudget.gui.components.HasPopupMenu;

public class AbstractTableWithPopup extends JTable implements HasPopupMenu {
	public BasicPopupMenu	popup;

	public AbstractTableWithPopup() {
		super();
		//this.setTableHeader(new TableHeaderWithPopup());
	}

	public AbstractTableWithPopup(int rows, int cols) {
		super(rows, cols);
		//this.setTableHeader(new TableHeaderWithPopup());
	}

	public BasicPopupMenu getPopup() {
		return popup;
	}
	
	public void setPopup(BasicPopupMenu newPopup){
		this.popup = newPopup;
	}

	@Override
	public void setupPopup() {}

	public class TableHeaderWithPopup extends JTableHeader implements HasPopupMenu{
		//not currently in use...
		public BasicPopupMenu	popup;

		public TableHeaderWithPopup(){
			super();
		}
		
		public TableHeaderWithPopup(TableColumnModel cm){
			super(cm);
		}
		
		public TableCellRenderer getDefaultRenderer(){
			System.out.println("getDefaultRenderer");
			return super.getDefaultRenderer();
		}
		
		@Override
		public void setupPopup() {
		}

		public BasicPopupMenu getPopup() {
			return popup;
		}
		
		public void setPopup(BasicPopupMenu newPopup){
			this.popup = newPopup;
		}
		
	}
}
